package com.zl.pojo;

public class FenYe {
    /**
     * 分页工具类
     */
    private Integer page;//当前请求的页码
    private Integer pagesCount;//总页码
    private Integer rows=3;//每页显示多少条数据
    private Integer rowsCount;//符合要求的记录总数
    private Integer pageRowStart;//当前页起始条
    private Integer pageRowEnd;//当前页结束条
    private Query query;//查询条件

    public Integer getPage() {
        return page;
    }

    public void setPage(Integer page) {
        this.page = page;
    }

    public Integer getPagesCount() {
        if(getRowsCount()%getRows()==0){
            pagesCount=getRowsCount()/getRows();
        }else{
            pagesCount=getRowsCount()/getRows()+1;
        }
        return pagesCount;
    }

    public void setPagesCount(Integer pagesCount) {
        this.pagesCount = pagesCount;
    }

    public Integer getRows() {
        return rows;
    }

    public void setRows(Integer rows) {
        this.rows = rows;
    }

    public Integer getRowsCount() {
        return rowsCount;
    }

    public void setRowsCount(Integer rowsCount) {
        this.rowsCount = rowsCount;
    }

    public Integer getPageRowStart() {//5   3
        pageRowStart=(getPage()-1)*getRows();
        return pageRowStart;
    }

    public void setPageRowStart(Integer pageRowStart) {
        this.pageRowStart = pageRowStart;
    }

    public Integer getPageRowEnd() {
        pageRowEnd=getPage()*getRows();
        return pageRowEnd;
    }

    public void setPageRowEnd(Integer pageRowEnd) {
        this.pageRowEnd = pageRowEnd;
    }

    public Query getQuery() {
        return query;
    }

    public void setQuery(Query query) {
        this.query = query;
    }

    @Override
    public String toString() {
        return "FenYe{" +
                "page=" + page +
                ", pagesCount=" + pagesCount +
                ", rows=" + rows +
                ", rowsCount=" + rowsCount +
                ", pageRowStart=" + pageRowStart +
                ", pageRowEnd=" + pageRowEnd +
                ", query=" + query +
                '}';
    }
}
